package com.demo.mybatis.Controller;

import com.demo.mybatis.Service.UserService;
import com.demo.mybatis.dao2.HeiheiMapper;
import com.demo.mybatis.model.MbbUser;
import com.demo.mybatis.model2.Heihei;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {

    @Autowired
    public UserService userService ;

    @RequestMapping(value = "/test")
    public MbbUser test(){
        MbbUser mbbUser = new MbbUser() ;
        mbbUser.setId("3");
        mbbUser.setName("aasdasd");

        try {
            userService.insert(mbbUser);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return mbbUser ;
    }


    @Autowired
    HeiheiMapper heiheiMapper ;

    @RequestMapping(value = "test2")
    public List<Heihei> test2(){
        Heihei heihei = null;
        return heiheiMapper.selectAll();
    }

}
